<?php
	include("../connect.php");
	
	mysql_query("SET character_set_results=utf8"); //lấy dữ liệu tiếng việt từ csdl
	$sql="SELECT *, DATE_FORMAT(ngay_dang,'%d-%m-%Y') AS ngay 
		  FROM mau_tin_td a, linh_vuc_td b 
		  WHERE a.ms_linh_vuc = b.ms_linh_vuc 
		  AND DATE_ADD(a.ngay_dang, INTERVAL a.thoi_gian_song DAY) <= NOW()";
	$rs=mysql_query($sql);
?>
  <tr>
    <td colspan="9"><h2><b>Danh sách mẩu tin tuyển dụng</b></h2></td>
  </tr>
  <tr>
    <td align="center" class="title_left">MÃ SỐ</td>
    <td align="center" class="title_row">LĨNH VỰC TUYỂN DỤNG</td>
    <td align="center" class="title_row">NGƯỜI TẠO</td>
    <td align="center" class="title_row">NHÀ TUYỂN DỤNG</td>
    <td align="center" class="title_row">NGÀY ĐĂNG</td>
	<td align="center" class="title_row">SỐ NGÀY TT</td>
    <td align="center" class="title_row">GIẤY PHÉP</td>
    <td align="center" class="title_row"><font color="#00FF00">Sửa</font></td>
    <td align="center" class="title_row"><font color="#FF0000">Xóa</font></td>
  </tr>
<?php
	if($rw=mysql_fetch_row($rs)){
?>
  <tr>
    <td class="stt"><?php echo $rw[0] ?>&nbsp;</td>
    <td class="data_row"><?php echo $rw[17] ?>&nbsp;</td>
    <td class="data_row"><?php echo $rw[2] ?>&nbsp;</td>
    <td class="data_row"><?php echo $rw[3] ?>&nbsp;</td>
    <td class="data_row"><?php echo $rw[18] ?>&nbsp;</td>
    <td class="data_row"><?php echo $rw[11] ?>&nbsp;</td>
    <?php
		if($rw[15]==1){
    		echo '<td class="data_row">Đã đăng</td>';
		}else {
    		echo '<td class="data_row"><a href="dang_tin_td/xl_cho_phep_dang_tin_td?mt_td=<?php echo $rw[0] ?>">Đăng</a></td>';
		}
	?>
    <td align="center" class="data_row"><a href="index.php?noidung=sua_td&&mt_td=<?php echo $rw[0];?>"><img src="images/edit.gif" border="0" /></a></td>
    <td align="center" class="data_row"><input type="checkbox" name="chkxoa" value="<?php echo $rw[0];?>"/></td>
  </tr>
<?php
	}
	else{
		echo '<tr><td colspan="9" align="center" style="background-color: white; border-left:1px solid gray; border-bottom:1px solid gray; border-right:1px solid gray; padding:5px;">Không tìm thấy</td></tr>';
	}
?>
  <tr>
  	<td height="20"></td>
  </tr>